package com.besttone;

import com.besttone.Result;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class XMLParse extends Activity {
	private static final String TAG = "XMLParse";
    private Button button_dom;
    private Button button_sax;
    private Button button_pull;
    private TextView view_result;
    
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        findViews();
        setListensers();
    }
    
    
    private void findViews() {
    	try {
    		button_dom = (Button) findViewById(R.id.dom);
    		button_sax = (Button) findViewById(R.id.sax);
    		button_pull = (Button) findViewById(R.id.pull);
			view_result = (TextView) findViewById(R.id.result);
		} catch (Exception e) {
			Log.e(TAG, "error" + e.toString());
			Toast.makeText(XMLParse.this,R.string.error,Toast.LENGTH_SHORT).show();
		}
    }
    
    //Listen for button clicks
    private void setListensers() {
    	button_dom.setOnClickListener(domParse);
    	button_sax.setOnClickListener(saxParse);
    	button_pull.setOnClickListener(pullParse);
    }
    
    private Button.OnClickListener domParse = new Button.OnClickListener() {
    	public void onClick(View v) {
    		Intent intent = new Intent();
    		intent.setClass(XMLParse.this, Result.class);
    		Bundle bundle = new Bundle();
    		intent.putExtras(bundle);
    		startActivity(intent);
    	}
    };
    
    private Button.OnClickListener saxParse = new Button.OnClickListener() {
    	public void onClick(View v) {
    		Intent intent = new Intent();
    		intent.setClass(XMLParse.this, SAXResult.class);
    		Bundle bundle = new Bundle();
    		intent.putExtras(bundle);
    		startActivity(intent);
    	}
    };
    
    private Button.OnClickListener pullParse = new Button.OnClickListener() {
    	public void onClick(View v) {
    		Intent intent = new Intent();
    		intent.setClass(XMLParse.this, PullResult.class);
    		Bundle bundle = new Bundle();
    		intent.putExtras(bundle);
    		startActivity(intent);
    	}
    };

}